from django.shortcuts import render, HttpResponse
import random
# Create your views here.
from utils.tencent.sms import send_sms_single
from django.conf import settings
def index(request):
    return HttpResponse('这个项目没问题')


def send_sms(request):
    tpl = request.GET.get('tpl')
    template_id = settings.TENCENT_SMS_TEMPLATE.get(tpl)
    if not template_id:
        return HttpResponse('模板不存在')
    code = random.randrange(1000, 9999)
    res = send_sms_single('13027088268', template_id, [code, ])
    print(res)
    return HttpResponse('发送成功了')